package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysWarehouseMapper;
import com.ruoyi.system.domain.SysWarehouse;
import com.ruoyi.system.service.ISysWarehouseService;

/**
 * 仓库Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-29
 */
@Service
public class SysWarehouseServiceImpl implements ISysWarehouseService 
{
    @Autowired
    private SysWarehouseMapper sysWarehouseMapper;

    /**
     * 查询仓库
     * 
     * @param warehouseId 仓库主键
     * @return 仓库
     */
    @Override
    public SysWarehouse selectSysWarehouseByWarehouseId(Long warehouseId)
    {
        return sysWarehouseMapper.selectSysWarehouseByWarehouseId(warehouseId);
    }

    /**
     * 查询仓库列表
     * 
     * @param sysWarehouse 仓库
     * @return 仓库
     */
    @Override
    public List<SysWarehouse> selectSysWarehouseList(SysWarehouse sysWarehouse)
    {
        return sysWarehouseMapper.selectSysWarehouseList(sysWarehouse);
    }

    /**
     * 新增仓库
     * 
     * @param sysWarehouse 仓库
     * @return 结果
     */
    @Override
    public int insertSysWarehouse(SysWarehouse sysWarehouse)
    {
        sysWarehouse.setCreateTime(DateUtils.getNowDate());
        return sysWarehouseMapper.insertSysWarehouse(sysWarehouse);
    }

    /**
     * 修改仓库
     * 
     * @param sysWarehouse 仓库
     * @return 结果
     */
    @Override
    public int updateSysWarehouse(SysWarehouse sysWarehouse)
    {
        sysWarehouse.setUpdateTime(DateUtils.getNowDate());
        return sysWarehouseMapper.updateSysWarehouse(sysWarehouse);
    }

    /**
     * 批量删除仓库
     * 
     * @param warehouseIds 需要删除的仓库主键
     * @return 结果
     */
    @Override
    public int deleteSysWarehouseByWarehouseIds(Long[] warehouseIds)
    {
        return sysWarehouseMapper.deleteSysWarehouseByWarehouseIds(warehouseIds);
    }

    /**
     * 删除仓库信息
     * 
     * @param warehouseId 仓库主键
     * @return 结果
     */
    @Override
    public int deleteSysWarehouseByWarehouseId(Long warehouseId)
    {
        return sysWarehouseMapper.deleteSysWarehouseByWarehouseId(warehouseId);
    }
}
